package ruanjiangongcheng;

import java.util.LinkedList;

public class homework2s 
{
	public static LinkedList splitstr(String str, char ge) 
	{
		LinkedList<String> text = new LinkedList<>();
		char[] change = stringToCharArray(str);
		String example = "";
		int m = 0;
		for (int j = 0; j < change.length; j++) 
		{
			if (change[j] != ge) 
			{
				example += change[j];
			} else 
			{
				text.add(example);
				example = "";
				m = j;
			}
		}
		example = "";
		if (m < change.length) 
		{
			for (int a = m + 1; a < change.length; a++) 
			{
				example += change[a];
			}
			text.add(example);
		}
		return text;

	}

	public static char[] stringToCharArray(String test_Word) 
	{
		char strf[] = new char[test_Word.length()];
		if (test_Word == null)
			return strf;

		
		for (int i = 0; i < test_Word.length(); i++) 
		{
			strf[i] = test_Word.charAt(i);
		}
		return strf;
	}
}
